export interface QrcodeItem {
  id: string
  name: string
  status: 'active' | 'inactive'
  createTime: string
  url: string
  remark?: string
}

// 生成指定范围内的随机数
const getRandomNumber = (min: number, max: number) => {
  return Math.floor(Math.random() * (max - min + 1)) + min
}

// 生成模拟数据
export const generateMockData = (count: number = 5): QrcodeItem[] => {
  const data: QrcodeItem[] = []
  const baseDate = '20250601' // 基础日期

  for (let i = 0; i < count; i++) {
    break;
    const randomNum = String(getRandomNumber(10000, 99999)).padStart(5, '0')
    const id = `QR${baseDate}${randomNum}`
    const createTime = new Date(2025, 5, 3, getRandomNumber(0, 23), getRandomNumber(0, 59)).toLocaleString()

    data.push({
      id,
      name: `码牌${i + 1}`,
      status: i % 3 === 0 ? 'inactive' : 'active',
      createTime,
      url: `https://pay.shouyin.com/cashier/beefgate?qrcode=${id}`,
      remark: i % 2 === 0 ? '测试码牌' : ''
    })
  }

  data.unshift({
    id: 'QR2025060310003',
    name: '特约商户-端内H5-乐刷聚合',
    status: 'active',
    createTime: '2025/6/3 12:00:00',
    url: 'https://pay.shouyin.com/cashier/beefgate?qrcode=QR2025060310003',
    remark: '备注内容'
  })

  data.unshift({
    id: 'QR2025060310002',
    name: '特约商户-端内H5-聚合支付',
    status: 'active',
    createTime: '2025/6/3 12:00:00',
    url: 'https://pay.shouyin.com/cashier/beefgate?qrcode=QR2025060310002',
    remark: '备注内容'
  })

  data.unshift({
    id: 'QR2025060310001',
    name: '普通商户-端内H5-聚合支付',
    status: 'active',
    createTime: '2025/6/3 12:00:00',
    url: 'https://pay.shouyin.com/cashier/beefgate?qrcode=QR2025060310001',
    remark: '备注内容'
  })

  return data
}

// 导出模拟数据
export const mockData = generateMockData()